package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dto.CartsProductDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface CartsConverter {


    @Mappings(
            {
                    @Mapping(source = "id", target = "productId"),
                    @Mapping(source = "price", target = "salePrice"),
                    @Mapping(source = "num", target = "productNum"),
                    @Mapping(source = "title", target = "productName")
            }
    )
    CartsProductDto item2CartVo(Item item);
}

